﻿using System;

namespace com.ddmresources.EnumMetadata.Core.Attributes
{
    /// <summary>
    /// This is the attribute that is used to decorate enum instances to which you want to associate "dynamic" metadata. In this context, 
    /// "dynamic" means using a JSON string to encode your metadata. This string format allows you to specify nested objects, which is not possible
    /// to do with standard attributes.
    /// 
    /// When you want to associate more flat, simple data with an enum instance, you would typically create a custom attribute class for that purpose.
    /// </summary>
    [Serializable]
    [AttributeUsage(AttributeTargets.Field)]
    public class EnumDynamicInfoAttribute: Attribute
    {
        #region Constructors

        /// <summary>
        /// Parameterless constructor, which exists only to allow some scenarios using the "Lax" methods
        /// </summary>
        public EnumDynamicInfoAttribute()
        {

        }

        /// <summary>
        /// This attribute is meaningless if it does not contain data, so use this constructor in general.
        /// </summary>
        /// <param name="info">The data (formatted as JSON) that will be used to populate the associated strongly typed metadata object</param>
        public EnumDynamicInfoAttribute(string info)
        {
            Info = info;
        } 
        #endregion

        #region Properties
        /// <summary>
        /// This property contains the actual data that will be used to fill the strongly typed metadata object. This data is
        /// in the form of a JSON string, and the EnumMetadata library will parse the string, and move the data into the 
        /// associated strongly typed metadata object.
        /// </summary>
        public string Info { get; set; } 
        #endregion
        
    }
}
